﻿using System.ComponentModel;
using Util;

namespace IterationLife.Extensions.Enums
{     
    /// <summary>
    /// 范围查询类型
    /// </summary>
    public enum RangeQueryType
    {
        /// <summary>
        /// 前
        /// </summary>
        [Description("前")]
        Before = 1,
        /// <summary>
        /// 后
        /// </summary>
        [Description("后")]
        After = 2
    }

    /// <summary>
    /// 范围查询枚举扩展
    /// </summary>
    public static class RangeQueryTypeExtensions
    {
        /// <summary>
        /// 获取描述
        /// </summary>
        public static string Description(this RangeQueryType? type)
        {
            return type == null ? string.Empty : type.Value.Description();
        }

        /// <summary>
        /// 获取值
        /// </summary>
        public static int? Value(this RangeQueryType? type)
        {
            return type?.Value();
        }
    }
}
